package com.example.hp.yuejian5.model;


import com.example.hp.yuejian5.RetrofitListener.RetrofitListener;
import com.example.hp.yuejian5.bean.IsAttentionBean;
import com.example.hp.yuejian5.service.IsAttentionMasterService;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

import static com.example.hp.yuejian5.other.url.INDEXURL;

public class IsAttentionMasterModel {

    private Retrofit retrofit;
    private IsAttentionMasterService isAttentionMasterService;
    public IsAttentionMasterModel()
    {
        retrofit=new Retrofit.Builder()
                .baseUrl(INDEXURL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
        isAttentionMasterService=retrofit.create(IsAttentionMasterService.class);
    }

    public void isAttentionmaster(String user_id, String master_id, final RetrofitListener listener)
    {
        Call<IsAttentionBean> call=isAttentionMasterService.isAttentionMaster(user_id, master_id);
        call.enqueue(new Callback<IsAttentionBean>() {
            @Override
            public void onResponse(Call<IsAttentionBean> call, Response<IsAttentionBean> response) {
                listener.onSuccess(response.body(),1);
            }

            @Override
            public void onFailure(Call<IsAttentionBean> call, Throwable t) {
                listener.onFail();
            }
        });
    }
}
